package notify

import (
	pkgConf "enotify/pkg/notify/conf"
	"time"
)

type Config struct {
	Concurrency int //并发量
	MaxQuene int //待处理消息最大数量
	Redis *Redis
	Debug bool //是否测试阶段，如果是不会真正的发送消息
	Group *GroupConfig
	Provider *pkgConf.Config //
	GroupExpire Duration //任务状态最大保存时间

}
type GroupConfig struct {
	WxUserInfoQueue int //WX 用户队列长度
	WxMsgQueue int //WX 消息队列长度
	WxMsgWorker int //WX 消息发送并发数量
	AppMsgQueue int //App 消息队列长度
	AppMsgWorker int //App 消息发送并发
	SmsMsgQueue int //Sms 消息队列长度
	SmsMsgWorker int //Sms 消息发送并发
	BatchNum int //用户分组数量
	UserPushWorker int //用户推送到不同的队列的并发数
}
type Redis struct {
	Network string
	Addr string
	Auth string
	Active int
	Idle int
	DialTimeout Duration
	ReadTimeout Duration
	WriteTimeout Duration
	IdleTimeout Duration
}
type Duration time.Duration

// UnmarshalText unmarshal text to duration.
func (d *Duration) UnmarshalText(text []byte) error {
	tmp, err := time.ParseDuration(string(text))
	if err == nil {
		*d = Duration(tmp)
	}
	return err
}